<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>变量运算</title>
    <script>
        function f1() {
            let num1 = 3;
            let num2 = 2;
            console.log(num1 + "+" + num2 + "=" + (num1 + num2));
            console.log(num1 + "-" + num2 + "=" + (num1 - num2));
            console.log(num1 + "*" + num2 + "=" + (num1 * num2));
            console.log(num1 + "/" + num2 + "=" + (num1 / num2));
            console.log(num1 + "%" + num2 + "=" + (num1 % num2));
            console.log(num1++);
            console.log(--num2);
            console.log(num1 > num2 && num1 > 5);
            console.log(num1 > num2 || num1 > 5);
            console.log(num1 > num2 ? "num1比num2大" : "num1小于等于num2")

        }
        function f2(){
            let num1 = 2;
            let num2 = "2";
            let num3 = 2;
            // 此时的比较不关心类型,只关心值的大小
            console.log(num1 == num2);
            // 恒等于,只有类型与值均一致时才返回true
            console.log(num1 === num2);
            console.log(num1 === num3);
        }
        function f3(){
            console.log(2**3);
            console.log(3**3);
            console.log(2**-2);
        }
    </script>
</head>
<body>
<button onclick="f1()">基本运算</button><br>
<button onclick="f2()">恒等于</button><br>
<button onclick="f3()">模方运算</button><br>
</body>
</html>